package com.ali.gts.servlet.controller;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RequestApiTestServlet extends HttpServlet {


    public void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse){
        System.out.println("URI=" + httpServletRequest.getRequestURI());
        System.out.println("URL="+ httpServletRequest.getRequestURL());

        System.out.println("客户端 IP 地址 = >" + httpServletRequest.getRemoteHost());

        System.out.println("客户端 IP 地址 addr = >" + httpServletRequest.getRemoteAddr());

        System.out.println("获取请求头中的user-agent 信息 = >" + httpServletRequest.getHeader("User-Agent"));

        System.out.println("获取请求的方式 是get 还是post = > " + httpServletRequest.getMethod());


    }
}
